<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import = "com.classes.Casemast, java.util.ArrayList, java.util.TreeMap, org.owasp.encoder.Encode" %>
<%@ page import = "com.mbbmap.security.dao.*" %>
<%@ include file="/jsp/map/include/user-dao.jsp" %>	
<%@page import="com.mbbmap.util.EncryptionHelper"%>
<%

TreeMap<String, String> search = (TreeMap<String, String>) request.getAttribute("search");

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="/jsp/map/include/html-meta.jsp" />
<title>MAYBANK</title>
<script src="<%= request.getContextPath() %>/js/report.js"></script>
</head>

<body onload="report.region_sla_init();">

<!-- Header -->
<%@ include file="/jsp/common/Header.jsp" %>	
<!-- End Header -->


<div class="row-fluid page" style="width:1200px; max-width:none;">
	<div class="span12">
		
		<jsp:include page="/jsp/map/include/report-nav.jsp">
			<jsp:param name="report_title" value='<%=EncryptionHelper.encrypt("Terminal Summary Report") %>' />
		</jsp:include>

		<form name="search_form" method="post" action="<%= request.getContextPath() + "/Report.do?dispatch=terminal_summary" %>" onsubmit="return report.search_region_sla_validate();">
			<div class="row-fluid form-horizontal search">
				<div class="span6">
				
					<div class="control-group">
						<label class="control-label">Period</label>
						<div class="controls">
							<input type="text" id="from_date" name="from_date" placeholder="eg. 23/01/2015" value="<%=search.containsKey("from_date") ? search.get("from_date") : "" %>" style="width:88px" /> to
							<input type="text" id="to_date" name="to_date" placeholder="eg. 09/02/2015" value="<%=search.containsKey("to_date") ? search.get("to_date") : "" %>" style="width:88px" />
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">Month</label>
						<div class="controls">
							<select id="month" name="month" style="width:115px">
							<% 
								String html = "<option value=\"\"></option>"
									+ "<option value=\"01\">January</option>"
									+ "<option value=\"02\">February</option>"
									+ "<option value=\"03\">March</option>"
									+ "<option value=\"04\">April</option>"
									+ "<option value=\"05\">May</option>"
									+ "<option value=\"06\">June</option>"
									+ "<option value=\"07\">July</option>"
									+ "<option value=\"08\">August</option>"
									+ "<option value=\"09\">September</option>"
									+ "<option value=\"10\">October</option>"
									+ "<option value=\"11\">November</option>"
									+ "<option value=\"12\">December</option>";
								
								if(search.containsKey("month") && search.get("month").length() > 0){
									html = html.replace("value=\"" + search.get("month") + "\"", "value=\"" + search.get("month") + "\" selected ");
								}
								
								out.println(html);
							%>
							</select>
							
							<input type="text" id="year" name="year" placeholder="eg. 2015" value="<%=search.containsKey("year") ? search.get("year") : "" %>" style="width:88px" />
						</div>
					</div>
					
				</div>
				
				<div class="span6">
				
					
					
				</div>
			</div>
			
			<div class="row-fluid">
				<div class="span12 btn-control search">
					<button id="search_submit" name="search_submit" type="submit" class="btn">Search</button>
					<button id="search_clear" name="search_clear" type="submit" class="btn">Clear</button>
					<button id="export_submit" name="export_submit" type="submit" class="btn">Export Data</button>
				</div>
			</div>
			
		</form>
		
		<div style="width:1200px; overflow-x:auto">
		<table class="tblDetails reportTbl"><thead>
			<tr>
				<th>No.</th>
				<th>MAP Reference No.</th>
				<th>Merchant Name</th>
				<th>TID</th>
				<th>MAP Serial No.</th>
				<th>Date Request Received</th>
				<th>Date Request Sent</th>
				<th>Vendor</th>
				<th>TMU Staff Name</th>
				<th>Status</th>
			</tr>
		</thead><tbody>
		<%
		int n = 0;
		for(TreeMap<String, String> r : (ArrayList<TreeMap<String, String>>) request.getAttribute("rArr")){
			html = "<tr>"
				+ "	<td>" + (++n) + "</td>"
				+ "	<td>" + r.get("reference_no") + "</td>"
				+ "	<td>" + r.get("merchant_name") + "</td>"
				+ "	<td>" + r.get("pos_tid") + "</td>"
				+ "	<td>" + r.get("serial_no") + "</td>"
				+ "	<td></td>"
				+ "	<td>" + r.get("sent_date") + "</td>"
				+ "	<td>" + r.get("vendor") + "</td>"
				+ "	<td>" + r.get("creator") + "</td>"
				+ "	<td>" + r.get("status") + "</td>"
				+ "</tr>";
			
			out.print(html);
		}
		%>
		</tbody></table>
		</div>
		
	</div>
</div>

<!-- Footer -->
<%@ include file="/jsp/common/Footer.jsp" %>	
<!-- End Footer -->


</body>
</html>